<%@page import="java.util.Date"%>
<%@page contentType= “text/html; charset=euc-kr ”%>
<%@page import="java.io.*", java.util.Date %>
<HTML>
<HEAD><TITLE>게시판 글쓰기 - 결과 화면</TITLE></HEAD>
<BODY>
<H2>글쓰기</H2>
<% request.setCharacterEncoding( "euc-kr" );
String name = request.getParameter(  "name");
String title = request.getParameter( "title");
String content =
request.getParameter( "contert");
Date date = new Date();
Long time = date.getTime();
String filename = time + ".txt";
String filePath = application.getRealPath("WebContent/bbswrite.jsp"+ filename);
FileWriter writer = new FileWriter(filePath);
try {
String str = "제목: " + title +"\n";
str += "글쓴이: " + name +"\n";
str += content;
writer.write(str);
out.println("저장되었습니다.");
}
catch (IOException ioe) {
out.println( "파일에 데이터를 쓸 수 없습니다. ");
}
finally {
try {
writer.close();
}
catch (Exception e) {
}
}
%>
</BODY>
</HTML>